#include"SltNode.h"
SLTNode* plist = NULL;
void test1()
{
	SLTPushBack(&plist, 1);//需要改变plist的值  实参传地址
	SLTNodePrintf(plist);

	SLTPushBack(&plist, 2);
	SLTNodePrintf(plist);

	SLTPushBack(&plist, 3);
	SLTNodePrintf(plist);

	SLTPopBack(&plist);
	SLTNodePrintf(plist);

	SLTPopBack(&plist);
	SLTNodePrintf(plist);

	SLTPopBack(&plist);
	SLTNodePrintf(plist);
}

void test2()
{
	SLTPushFront(&plist, 1);
	SLTNodePrintf(plist);

	SLTPushFront(&plist, 2);
	SLTNodePrintf(plist);

	SLTPushFront(&plist, 3);
	SLTNodePrintf(plist);

	SLTPopFront(&plist);
	SLTNodePrintf(plist);

	SLTPopFront(&plist);
	SLTNodePrintf(plist);

	SLTPopFront(&plist);
	SLTNodePrintf(plist);

}
void test3()
{
	SLTPushBack(&plist, 1);
	SLTPushBack(&plist, 2);
	SLTPushBack(&plist, 3);
	SLTPushBack(&plist, 4);
	SLTPushBack(&plist, 5);
	SLTNodePrintf(plist);

	int x = 0;

	scanf("%d", &x);
	SLTNode* pos = SLTNodeFind(plist, x);
	if (pos != NULL)
	{
		SLTInsert(&plist, pos, x * 10);
	}
	SLTNodePrintf(plist);


}
void test4()
{
	SLTPushBack(&plist, 1);
	SLTPushBack(&plist, 2);
	SLTPushBack(&plist, 3);
	SLTPushBack(&plist, 4);
	SLTPushBack(&plist, 5);
	SLTNodePrintf(plist);

	int x = 0;

	scanf("%d", &x);
	SLTNode* pos = SLTNodeFind(plist, x);
	if (pos != NULL)
	{
		SLTInsertAfter(pos, x * 10);
	}
	SLTNodePrintf(plist);


}
void test5()
{
	SLTPushBack(&plist, 1);
	SLTPushBack(&plist, 2);
	SLTPushBack(&plist, 3);
	SLTPushBack(&plist, 4);
	SLTPushBack(&plist, 5);
	SLTNodePrintf(plist);

	int x = 0;

	scanf("%d", &x);
	SLTNode* pos = SLTNodeFind(plist, x);
	if (pos != NULL)
	{
		SLTErase(&plist, pos);
	}
	SLTNodePrintf(plist);


}

void test6()
{
	SLTPushBack(&plist, 1);
	SLTPushBack(&plist, 2);
	SLTPushBack(&plist, 3);
	SLTPushBack(&plist, 4);
	SLTPushBack(&plist, 5);
	SLTNodePrintf(plist);

	int x = 0;

	scanf("%d", &x);
	SLTNode* pos = SLTNodeFind(plist, x);
	if (pos != NULL)
	{
		SLTEraseAfter(pos);
	}
	SLTNodePrintf(plist);


}
int main()
{
	//test1();
	//test2();
	//test3();//pos之前插入
	//test4();//pos之后插入
	//test5();//删除pos位置
	test6();//删除pos位置后一个结点

	return 0;
}











